<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>代金券列表</title>
  <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
  <meta content="yes" name="apple-mobile-web-app-capable"/>
  <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
  <meta content="telephone=no" name="format-detection"/>
  <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  <script src="__STATIC__/layer/layer.js"></script>
</head>
<body>
{if condition="!empty($coupon)"}
    {foreach name="coupon" item="v"}
      <div>
        <a href="javascript:;" onclick="chose_coupon(this,{$v.id})">
          <img class="logo" src="{$v.img}" width="80px;" height="80px;">
          抵价金额：<span class="value">{$v.value}</span>
          购买价格：<span class="price">{$v.price}</span>
        </a>
      </div>
    {/foreach}
  {else /}
  没有任何可用的优惠券
  {/if}
</body>
</html>
<script>
  /**
   * @param  id  优惠券id
   */
  function chose_coupon(obj,id){
      var logo = $(obj).find('.logo').attr('src');
      var value = $(obj).find('.value').text();
      var price = $(obj).find('.price').text();
      javascript:window.parent.select_cash_coupon(id,logo,value,price);
  }
</script>